
file="$1"
field="$2"

keys=$(cat $file  | cut -f1,2 -d\; | sort -n -k2 -t\; | sort -ns -k1 -t\; | uniq)
for k in $keys ; do 
  key=$(echo $k | sed 's/\;/ /g')
  values=$(grep -E "$k;" $file | cut -f${field} -d\;)
  echo $key $values
done

